# -*- coding: utf-8 -*-
##将hupu-post.txt文件中的关键字文本以及出现频率输出为词云

import wordcloud as wordcloud
from wordcloud import WordCloud
import matplotlib.pyplot as plt


f = open('most_popular.txt', 'r').read()
font = r'C:\Windows\Fonts\simsunb.ttf'
wc = WordCloud(collocations=False, font_path='C:\Windows\Fonts\simhei.ttf',width=1400, height=1400, margin=2).generate(f)

plt.imshow(wc)
plt.axis("off")
plt.show()

wc.to_file('example1.png')
